package org.apache.zookeeper;

import java.util.ArrayList;

/**
 * @author xiezhicong xiezc@3vjia.com
 * @since 2019-06-27 17:20
 */
public class TestClient {

    public static void main(String[] args) throws Exception{
        ZooKeeper zk = new ZooKeeper("127.0.0.1:2181", 6000, null);
        //System.out.println(zk.getState());
       // zk.create("/cong","123".getBytes(),ZooDefs.Ids.OPEN_ACL_UNSAFE,CreateMode.PERSISTENT);
      String a = new String(zk.getData("/cong", new Watcher() {
          @Override
          public void process(WatchedEvent event) {
              System.out.println(2222222);
          }
      }, null));

      zk.getData("/cong2",new congWatcher(),null);
        System.out.println(a);
        System.in.read();
    }

}

class congWatcher implements Watcher{
    @Override
    public void process(WatchedEvent event) {
        System.out.println(3333);
    }
}
